Skip to content

fix: newsstand player movement bug + stuck key issue#277

Merged
r4pt0s merged 1 commit into
zero-to-mastery:mainfrom
EXE901:fix/bookcase-movement-lock
Oct 29, 2025
Merged

fix: newsstand player movement bug + stuck key issue#277
r4pt0s merged 1 commit into
zero-to-mastery:mainfrom
EXE901:fix/bookcase-movement-lock

Conversation

@EXE901
Copy link
Copy Markdown
Member

@EXE901 EXE901 commented Oct 28, 2025

Fix: Newsstand player movement bug + stuck key issue

Issues Fixed

Closes #276

Changes Made

Primary Fix: Newsstand Movement Bug

  • Fixed player continuing to run after colliding with newsstand
  • Added immediate velocity reset on collision: player.vel = k.vec2(0, 0)
  • Added 300ms delay before showing prompt to allow key release
  • Properly locks player state during interaction

Bonus Fix: Stuck Key State (Global)

  • Fixed character auto-movement after closing dialogs/interactions
  • Added keyup event simulation in closeCustomPrompt to clear stuck keyboard state
  • Dispatches keyup events for all movement keys (arrows + WASD) on dialog close
  • Benefits ALL interactions using showCustomPrompt (newsstand, locker, etc.)

Refactoring

  • Newsstand now uses showCustomPrompt from utils.js for consistency
  • Removed custom prompt implementation in favor of shared utility
  • Maintains arrow key navigation and pagination features

Files Changed

  • src/interactions/map_start/mailboxMainArea.interaction.js - Fixed newsstand collision and movement
  • src/utils.js - Added keyup simulation to closeCustomPrompt to prevent stuck keys

Testing

  • ✅ Player stops immediately when colliding with newsstand
  • ✅ No running animation during news dialog
  • ✅ Arrow key navigation works in newsstand
  • ✅ Locker and other interactions also benefit from stuck key fix

Main Fix:
- Fixed player continuing to run after colliding with newsstand
- Added immediate velocity reset on collision
- Added delay before showing prompt to allow key release
- Newsstand now uses showCustomPrompt from utils.js for consistency

Bonus Fix:
- Added keyup event simulation in closeCustomPrompt to clear stuck keyboard state
- Prevents character auto-movement after closing any dialog/interaction
- Benefits ALL interactions using showCustomPrompt (newsstand, locker, etc.)

Closes zero-to-mastery#276
Copy link
Copy Markdown
Collaborator

@r4pt0s r4pt0s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job @EXE901 🙌🏻🎉

@r4pt0s r4pt0s merged commit 8a08dd1 into zero-to-mastery:main Oct 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Character becomes unresponsive after interacting with the bookcase at the start

2 participants